
{include 'header.tpl'}
<div class="contant  myorder">
    <div class="header">
        <div class="header_s">
            <span class="back"><a target="_blank" href="javascript:window.history.go(-1);"><i class="iconfont fan">&#xe679;</i></a></span>
            <span class="title">{$status_name}订单</span>
            <span class="add_ads">&nbsp;</span>
            <div class="clear"></div>
        </div>
    </div>

    <div id="list_order" class="list_order">
        {if $order_list}
        {foreach from=$order_list item=order name=foo}
        <div class="orderlist">
            <span>下单时间：{$order.create_time}</span>
            <div class="cart_conts">
            {foreach from=$order.products item=product name=foo}
                <div class="cart_contes_ct">
                    <div class="cart_contes_tltl cf"><div class="cart_tity"> {$product.title}
                            {if $product.spec_list}
                                {assign var=slist value=json_decode($product.spec_list)}
                                {foreach from=$slist item=i name=foo}
                                    {assign var=t value=json_decode($i,true)}
                                    <br><span>{$t.name}:{$t.value}</span>
                                {/foreach}
                            {/if}
                        </div><span class="cart_lty">×{$product.paynum}</span><span class="conts_tlt_ad"><em>￥{$product.price_new*$product.paynum}</em></span>
                    </div>
                </div>
            {/foreach}
                <div class="cart_contes_ct">
                    <div class="cart_contes_tltl">配送费：<span class="conts_tlt_ad">￥{$order.send_price}</span></div>
                    <div class="cart_contes_tltl">优惠金额：<span class="conts_tlt_ad">￥{floatval($order.youhui_price)}</span></div>
                    <!--<div class="cart_contes_tltl" style=" color:#9B9B9B;">由品牌商<em>美未央</em>进行派送</div>-->
                </div>

                <div class="cart_contes_ct">
                    <div class="cart_contes_tlty">合计<span class="order_red">￥{$order.pay_price}</span></div>
                    <div class="cart_cont_rg">
                        {if $order.status == 1}
                        <a  class="btn fr white" href="/order/detail?oid={$order.o_id}" >马上支付</a><a  class="btn fr white cancel_order" style=" color:#999; border: 1px #999 solid;" o_id="{$order.o_id}"  href="javascript:void(0)" >取消订单</a>
                        {/if}
                        {if $order.status ==2}
                            <span class="cart_cont_text">商家正在接单中</span>
                        {/if}
                        {if $order.status ==3}
                            <span class="cart_cont_text">商家已接单</span>
                        {/if}
                        {if $order.status ==4}
                            <span class="cart_cont_text">派送中</span>
                        {/if}
                        {if $order.status ==5}
                            <span class="cart_cont_text">已完成</span>
                        {/if}
                        {if $order.status ==6}
                            <span class="cart_cont_text">已取消</span>
                        {/if}
                    </div>
                </div>
            </div>
            {if $order.status ==3 || $order.status==4}
            <div class="stores_list">
                <div class="stores_title">店铺：{$order.shopInfo.name}</div>
                <div class="stores_cont cf">
                    <div class="stores_img"><img src="{Service_Attach::getInstance()->getThumbUrl($order['shopInfo']['shop_img'])}"></div>
                    <div class="stores_address">
                        <div class="address_title">{$order.shopInfo.province}{$order.shopInfo.city}{$order.shopInfo.address}</div>
                        <div class="address_date">置业时间：周一至周日 {$order.shopInfo.start_work_time}-{$order.shopInfo.stop_work_time}</div>
                    </div>
                    <div class="stores_tel"><a href="tel:{$order.shopInfo.phone}"><img src="/mall2/images/store_tel.png"></a></div>
                </div>
            </div>
            {/if}
        </div>
            {/foreach}
            {else}
            <div id="list_order" class="list_order">
                <div class="order_p">
                    <h5>居然还没有订单</h5>
                    <p>小红薯等您来翻牌哦</p>
                </div>
                <div class="order_btn"><a href="/">外卖首页</a></div>
            </div>
        {/if}


    </div>
</div>
{literal}
<script>
  $('.cancel_order').click(function(){
      var oid=$(this).attr('o_id');
      $.post("/order/cancel",{oid:oid},function(data){
        if(data.code==200){
            $.alert("取消成功",function(){
               window.location.href= window.location.href;
            });
        }
      },'json');
  });
</script>
{/literal}
{include 'footer.tpl'}